﻿Option Strict On
Option Explicit On

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Xml.Linq
Imports GenDotNet.TemplateSupport
Imports GenDotNet.TemplateSupport.VB
Imports GenDotNet.Task.Common
Imports GenDotNet.ObjectModel
Imports GenDotNet.TemplateSupport.Strings
Imports <xmlns:orm="http://kadgen.com/KADORM.xsd">
Imports <xmlns="http://kadgen.com/tempCode.xsd">

Public Class BizObjectDesignerTemplate
   Inherits DotNetBase


#Region "Overriding methods"

   Public Overrides ReadOnly Property Id() As System.Guid
      Get
         Return New Guid("{F3A62567-BA02-4545-97D5-527D2676C70E}")
      End Get
   End Property

   Protected Overrides Function GetFileImports() As GenDotNet.TemplateSupport.ImportInfoCollection
      ' Add standard imports in the ImportInfoCollection constructor, 
      ' or here using the Add methods of the ImportInfoCollection 
      ' base class. You should rarely pass string.
      Return New ImportInfoCollection
   End Function

   Protected Overrides Function GetFileName(ByVal current As GenDotNet.Model.Common.IBaseData) As String
      ' NEWTEMPLATE: Update the following file name
      Dim currentObjectData = CType(current, IObjectData)
      Return OutputFileName(NamingFactory.GetDesignerName(currentObjectData.ClassName))
   End Function

#End Region

   Protected Overrides Function GenerateContents() As String
      ' The class info takes care of a lot of the grimy formatting and avoids typos
      ' use these info classes where practical for clarity and ease of use
      Dim classInfo = New TypeInfo(ObjectData.ClassName, _
                             Scope.Public, _
                             TypeCategory.Class, _
                             TypeModifiers.Partial)

      classInfo.InheritsFrom = New TypeInfo(ObjectData.ClassName)

      classInfo.Attributes.AddSerializable()
      Return OutputClass(classInfo, Function() _
<code>
   <%= OutputConstructor(Scope.Private, Function() String.Empty) %>
</code>.Value)

   End Function

End Class
